
#include <unistd.h>

#include "test_server.h"

#include "../net/TCPServer.h"
#include "testTCPServer.h"

/** The TCP server in its default mode behaves as an echo server. This can be
 * tested by instantiation and using telnet to probe its behaviour.
 * 
 * @param hostname
 * Usually "0.0.0.0"
 * 
 * @param portno
 * Listening port.
 * 
 * @param mp
 * Memory pool to use. */
void tests::testTCPServer(const char *hostname, int portno, apr_pool_t *mp)
{
   TCPServer *tcpserv = new TCPServer(1, portno, hostname, mp);
   tcpserv->startSessionThreads();
   tcpserv->startListeningThread();
   while (!allstop)
   {
      sleep(1);
   }
   delete tcpserv;
}
